﻿### Brief: feudal_government
#
# This is referenced in code
#
feudal_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
#		dynasty_named_realms = yes
		royal_court = yes
		legitimacy = yes
	}

	fallback = 1

	primary_holding = castle_holding
	required_county_holdings = { castle_holding city_holding church_holding }

	house_unity = clan_house_unity		# Shogunate

	vassal_contract_group = feudal_vassal

	ai = {
		use_legends = yes
	}

	flag = may_elevate_co_monarch
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_feudal
	flag = government_is_settled
	color = hsv{ 0.67 1.00 0.78 }
}

republic_government = {
	primary_holding = city_holding
	valid_holdings = { castle_holding }
	required_county_holdings = { city_holding castle_holding church_holding }

	government_rules = {
		inherit_from_dynastic_government = no
	}

	ai = {
		arrange_marriage = no
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
		use_legends = no
	}

	vassal_contract_group = republic_vassal

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_republic
	flag = government_is_settled
	color = hsv{ 0.00 1.00 0.98 }
}

### Brief: theocracy_government
# Head of faith will always get this if possible
#
# This is referenced in code
#
theocracy_government = {
	government_rules = {
		religious = yes
		inherit_from_dynastic_government = no
	}

	primary_holding = church_holding
	valid_holdings = { castle_holding tribal_holding nomad_holding herder_holding }
	required_county_holdings = { church_holding castle_holding city_holding }

	ai = {
		use_legends = no
	}

	can_get_government = {
		NOT = {
			faith = {
				has_doctrine = doctrine_theocracy_lay_clergy
			}
		}
	}

	vassal_contract_group = theocracy_vassal

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_theocracy
	flag = government_is_settled
	color = hsv{ 0.00 0.00 0.78 }
}

### Brief: clan_government
clan_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		royal_court = yes
		legitimacy = yes
		dynasty_named_realms = yes
	}

	primary_holding = castle_holding
	primary_heritages = { heritage_arabic heritage_iranian heritage_turkic }

	fallback = 2

	preferred_religions = { islam_religion }

	valid_holdings = { castle_holding }
	required_county_holdings = { castle_holding city_holding church_holding }
	always_use_patronym = yes

	house_unity = clan_house_unity
	tax_slot_type = clan_tax_slot

	vassal_contract_group = clan_vassal

	ai = {
		use_legends = yes
	}

	opinion_of_liege = {
		scope:vassal = {
			if = {
				limit = {
					is_powerful_vassal = yes
					NOT = {
						is_allied_to = scope:liege
					}
				}
				value = clan_powerful_vassal_no_alliance_opinion_penalty_value
			}
		}
	}
	opinion_of_liege_desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:vassal = {
						NOT = {
							is_allied_to = scope:liege
						}
						is_powerful_vassal = yes
					}
				}
				desc = "GOVERNMENT_CLAN_NOT_ALLIED_POWERFUL"
			}
		}
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_clan
	flag = may_appoint_viziers
	flag = government_is_settled
	color = hsv{ 0.39 0.93 0.54 }
}

tribal_government = {
	government_rules = {
		rulers_should_have_dynasty = yes
		regiments_prestige_as_gold = yes
		royal_court = yes
		legitimacy = yes
	}

	supply_limit_mult_for_others = -0.5
	primary_holding = tribal_holding
	required_county_holdings = { tribal_holding }

	valid_holdings = { castle_holding }

	prestige_opinion_override = { -10 0 3 5 10 20 }
	always_use_patronym = yes
	affected_by_development = no

	vassal_contract_group = tribal_vassal

	ai = {
		use_legends = yes
	}

	character_modifier = {
		title_creation_cost_mult = -0.5
		army_maintenance_mult = -0.5

		feudal_government_vassal_opinion = -20
		clan_government_vassal_opinion = -20
		republic_government_vassal_opinion = -20

		character_travel_safety = 10

		ai_war_chance = 0.25
		monthly_prestige = 0.2
	}

	flag = government_can_raid_rule
	flag = may_elevate_co_monarch
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_tribal
	flag = government_is_settled
	color = hsv{ 0.02 0.75 0.36 }
}

### Brief: mercenary_government
# Mercenary will always get this
#
# This is referenced in code
#
mercenary_government = {
	government_rules = {
		court_generate_spouses = no
		council = no
		inherit_from_dynastic_government = no
	}

	court_generate_commanders = 5

	ai = {
		arrange_marriage = no
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
		use_legends = no
	}

	flag = cannot_be_vassal_or_liege
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_mercenary
	color = hsv{ 0.00 0.00 0.66 }
}

### Brief: holy_order_government
# Holy order will always get this
#
# This is referenced in code
#
holy_order_government = {
	government_rules = {
		council = no
		court_generate_spouses = no
		inherit_from_dynastic_government = no
	}

	court_generate_commanders = 5

	ai = {
		arrange_marriage = no
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
		use_legends = no
	}

	valid_holdings = { castle_holding city_holding }

	flag = cannot_be_vassal_or_liege
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_holy_order
	color = hsv{ 0.00 0.00 0.66 }
}

### Brief: administrative_government
# Default administrative government, used for Byzantium
#
# This is referenced in code
#
administrative_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		royal_court = yes
		administrative = yes
		landless_playable = yes
		legitimacy = yes
		state_faith = yes
		use_as_base_on_landed = yes
		use_as_base_on_rank_up = yes
		inherit_from_dynastic_government = no
		sticky_government = yes
	}

	domicile_type = estate

	fallback = 3

	primary_holding = castle_holding
	valid_holdings = { city_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	vassal_contract_group = admin_vassal

	character_modifier = {
		levy_size = -0.5
		feudal_government_tax_contribution_mult = -0.5
		feudal_government_levy_contribution_mult = -0.5
		clan_government_tax_contribution_mult = -0.5
		clan_government_levy_contribution_mult = -0.5
		men_at_arms_cap = -2
		men_at_arms_limit = -2
		knight_limit = -5
		vassal_limit = 100
		active_accolades = -1
		title_creation_cost_mult = -0.5
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_administrative

	# These flags only exist for loc and in-game descriptions
	flag = government_has_influence
	flag = government_has_title_men_at_arms
	flag = government_has_powerful_families
	flag = government_is_settled
	color = { 72 6 92 }
}

### Brief: landless_adventurer_government
# Default landless adventurer government
#
# This is referenced in code
#
landless_adventurer_government = {
	government_rules = {
		court_generate_spouses = no
		council = no
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		landless_playable = yes
		conditional_maa_refill = yes
		use_title_tier_modifiers = no
		mercenary = yes
		allow_out_of_realm_inheritance = yes
		use_as_base_on_landed = yes
		use_maa_maintenance = no
	}

	domicile_type = camp
	court_generate_commanders = no

	can_get_government = {
		any_held_title = {
			tier = tier_duchy
			is_landless_type_title = yes
		}
	}

	valid_holdings = { tribal_holding church_holding castle_holding city_holding }

	character_modifier = {
		active_accolades = -100
		knight_limit = 2
		men_at_arms_cap = -3
		men_at_arms_limit = -2
		character_travel_speed = 20
		siege_weapon_siege_value_mult = -0.5
		mercenary_hire_cost_mult = 1
		short_reign_duration_mult = -5
		long_reign_bonus_mult = -1
		domicile_travel_speed = -0.75
		monthly_wanderer_lifestyle_xp_gain_mult = 0.15
	}

	ai = {
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
		use_legends = no
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = cannot_be_vassal_or_liege
	flag = government_is_landless_adventurer
	color = hsv{ 0.00 0.00 0.66 }
}

### Brief: nomad_government
# Default nomad government, used for the Steppe Region
#
# This is referenced in code
#
nomad_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		royal_court = yes
		landless_playable = yes
		legitimacy = yes
		use_as_base_on_rank_up = yes
		use_as_base_on_landed = yes
		conditional_maa_refill = yes
		uses_county_fertility = yes
		uses_culture_and_house_head_named_realms = yes
		sticky_government = yes
		obedience = yes
		subject_men_at_arms = yes
		no_capital_movement_cooldown = yes
	}

	domicile_type = yurt

	primary_holding = nomad_holding
	valid_holdings = { nomad_holding castle_holding tribal_holding }
	required_county_holdings = { nomad_holding }

	generated_character_template = nomadic_chieftain_character
	
	affected_by_development = no
	max_dread = 150

	vassal_contract_group = nomad_vassal
	
	character_modifier = {
		steppe_travel_danger = steppe_high_danger_reduction
		plains_travel_danger = steppe_high_danger_reduction
		drylands_travel_danger = drylands_medium_danger_reduction
		mountains_travel_danger = mountains_medium_danger_reduction
		steppe_cancel_negative_supply = yes
		ignore_negative_opinion_of_culture = yes
		county_fertility_decline_add = -15
		movement_speed = 0.1
		movement_speed_land_raiding = 0.1
		the_great_steppe_supply_limit_add = 10000
		game_rule_extra_nomads_arabs_supply_limit_add = 10000
		game_rule_extra_nomads_horn_supply_limit_add = 10000
		game_rule_extra_nomads_sahel_supply_limit_add = 10000
		game_rule_extra_nomads_sami_supply_limit_add = 10000
		game_rule_extra_nomads_tibet_supply_limit_add = 10000
		domain_limit = -1
		ai_war_cooldown = -0.5
		ai_war_chance = 2
		men_at_arms_maintenance = -0.5
		supply_duration = 1
		county_opinion_add = 25
		title_creation_cost_mult = -0.5
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_nomadic
	flag = government_can_raid_rule
	flag = government_can_use_tributary_men_at_arms
	flag = can_start_war_with_raised_troops
	flag = ignores_faith_marriage_penalties
	flag = no_hostile_attrition_in_steppe # Done in code, here for loc
	flag = movement_speed_from_government
	flag = land_raiding_movement_speed_from_government
	flag = can_raze_holdings

	# These flags only exist for loc and in-game descriptions
	color = { 255 127 80 }
}

### Brief: herder_government
# Default herder government, used for the Steppe Region
#
# This is referenced in code
#
herder_government = {
	primary_holding = herder_holding
	valid_holdings = { herder_holding castle_holding tribal_holding }
	required_county_holdings = { herder_holding }

	generated_character_template = herder_character

	government_rules = {
		court_generate_spouses = no
		council = no
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		uses_county_fertility = yes
		replenishes_county_fertility = yes
		deny_powerful_vassal = yes
		redirects_wars_to_overlord = yes
	}
	
	character_modifier = {
		knight_limit = -100
		active_accolades = -100
		county_opinion_add = 100
		monthly_income_mult = -10
	}

	ai = {
		use_lifestyle = no
		arrange_marriage = no
		use_goals = no
		use_decisions = no
		use_scripted_guis = no
		use_legends = no
		perform_religious_reformation = no
	}

	vassal_contract_group = herder_vassal

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_herder
	flag = ignores_faith_marriage_penalties
	color = { 235 213 52 }
}
